package com.zerdoor.controller;

import com.zerdoor.service.HelpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Project: acg
 * Module ID: 007
 * Comments: 文章显示
 * JDK version used: JDK1.7
 * Namespace: controller
 * Author：xiaoji
 * Create Date：2014-11-14
 * Modified By：   <修改人中文名或拼音缩写>
 * Modified Date:  <修改日期，格式:YYYY-MM-DD>
 * Why & What is modified  <修改原因描述>
 * Version:                  <版本号>
 */
@Controller
@RequestMapping("/help")
public class HelpController {

    @Autowired
    private HelpService helpService;

    /**
     * FunName:           list
     * Description :      文章列表
     * @return String：返回页面
     * @Author:       xiaoji
     * @Create Date: 2014-10-27
     */
    @RequestMapping(value="/list",method = RequestMethod.GET)
    public String helpList(int type, Model model){

        model.addAttribute("list", helpService.getHelpList(type));
        return "/help/list";
    }



    /**
     * FunName:           list
     * Description :      文章列表
     * @return String：返回页面
     * @Author:       xiaoji
     * @Create Date: 2014-10-27
     */
    @RequestMapping(value="/helpContent",method = RequestMethod.POST)
    @ResponseBody
    public Map<String, Object> helpContent(int id){

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("content", helpService.getHelpContent(id));
        return map;
    }
}
